#include #include #define NODE_3 3 // Node 3 MAC uint8_t macNode3[] = {0x58, 0xE6, 0xC5, 0x19, 0xB9, 0xBC}; typedef struct { int targetID; int command; } Message; Message msg; void setup() { Serial.begin(115200); WiFi.mode(WIFI_STA); if (esp_now_init() != ESP_OK) { Serial.println("ESP-NOW init failed"); return; } esp_now_peer_info_t peerInfo = {}; memcpy(peerInfo.peer_addr, macNode3, 6); peerInfo.channel = 0; peerInfo.encrypt = false; if (esp_now_add_peer(&peerInfo) != ESP_OK) { Serial.println("Peer add failed"); return; } Serial.println("Node 1 (Master) ready"); } void loop() { msg.targetID = NODE_3; msg.command = 1; Serial.println("Sending..."); esp_err_t result = esp_now_send(macNode3, (uint8_t *)&msg, sizeof(msg)); if (result == ESP_OK) { Serial.println("Send success"); } else { Serial.println("Send fail"); } delay(2000); }